package com.framwork.core.api.addressbook.user.input;

import com.alibaba.fastjson.JSONObject;
import com.framwork.core.base.AbstractAPIInput;
import com.framwork.core.base.em.RequestMappering;
import okhttp3.FormBody;
import okhttp3.RequestBody;

import java.text.MessageFormat;

/**
 * @author ：james.liu
 * @date ：Created in 2022/3/7 13:27
 * @description：
 * @version: 1.0
 */
public class OpenApisContactV3UsersUserIdInput extends AbstractAPIInput {

    private String userIdType;

    private String departmentIdType;

    public String getUserIdType() {
        return userIdType;
    }

    public void setUserIdType(String userIdType) {
        this.userIdType = userIdType;
    }

    public String getDepartmentIdType() {
        return departmentIdType;
    }

    public void setDepartmentIdType(String departmentIdType) {
        this.departmentIdType = departmentIdType;
    }

    public final RequestBody toRequestBody() {
        final FormBody.Builder builder = new FormBody.Builder();
        builder.add("user_id_type", this.getUserIdType());
        builder.add("department_id_type", this.getDepartmentIdType());
        return builder.build();
    }

    public final String toBody(OpenApisContactV3UsersUserIdInput input) {
        JSONObject r = new JSONObject();
        r.put("department_id_type", input.getUserIdType());
        r.put("user_id_type", input.getUserIdType());
        return r.toJSONString();
    }

    public void setCmdId(OpenApisContactV3UsersUserIdInput input){
        String mapperName = RequestMappering.open_apis_contact_v3_departments_department_id_children.getMapperName();
        MessageFormat.format(mapperName, input.getUserIdType());

    }
}
